Add Cloud Run runtime guard alerts - #129
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50520dec7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| issues.append(f"{len(failures)} Cloud Run failure log(s) for {service}") | ||
| details.extend(_summarize(entry) for entry in failures[:5]) | ||
|
|
||
| if services and require_success and success_count == 0: |
There was a problem hiding this comment.
Require a heartbeat per monitored service
When RUNTIME_GUARD_REQUIRE_SUCCESS=true and multiple Cloud Run services are configured, a success from any one service increments the shared success_count, so a slot/service with no requests in the lookback window is not reported as missed as long as another service ran. This defeats the missed-run heartbeat documented for slot deployments; track successes per service and alert for each configured service with zero successes.
Useful? React with 👍 / 👎.
| if not issues: | ||
| service_text = ", ".join(services) if services else "<none configured>" | ||
| print( | ||
| f"Runtime guard OK for {name}: services={service_text}, lookback={lookback_minutes}m, successes={success_count}" | ||
| ) | ||
| return 0 |
There was a problem hiding this comment.
Fail when no Cloud Run services are configured
If none of RUNTIME_GUARD_CLOUD_RUN_SERVICES, CLOUD_RUN_SERVICES, CLOUD_RUN_SERVICE, or CLOUD_RUN_SERVICE_TARGETS_JSON is set, _load_services() returns an empty list and, with quiet Scheduler logs, this branch exits 0 with services=<none configured>. In that setup the guard never queries Cloud Run logs and silently misses all request/runtime failures, so the required service configuration should be treated as an alerting/configuration error unless scheduler-only mode is explicitly requested.
Useful? React with 👍 / 👎.
Summary
Validation